package com.uqbar.game.components.extra;

import com.uqbar.game.scene.PlayScene;
import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.GameComponent;
import com.uqbar.vainilla.GameScene;
import com.uqbar.vainilla.appearances.Sprite;

public class Life extends GameComponent<GameScene> {

	private PlayScene playScene;
	
	public Life(PlayScene playScene){
		super(709, 10);
		this.playScene = playScene;
	}
	
	public void update(DeltaState deltaState){
		this.showLife();
	}
	
	public void showLife(){
		if(this.playScene.getSpacecraft().getLife() == 3){
			Sprite s = Sprite.fromImage("/life_and_score/life_030.png");
			this.setAppearance(s);
		}
		if(this.playScene.getSpacecraft().getLife() == 2){
			Sprite s = Sprite.fromImage("/life_and_score/life_02.png");
			this.setAppearance(s);
		}
		if(this.playScene.getSpacecraft().getLife() == 1){
			Sprite s = Sprite.fromImage("/life_and_score/life_01.png");
			this.setAppearance(s);
		}
	}
	
}
